package com.amarsoft.xxniu.util;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;

public class Tools {
	public static void closeDB(Connection conn,Statement st,ResultSet rs){
		try {
			if(rs != null){
				rs.close();
				rs = null;
			}
			if(st != null){
				if(st instanceof Statement)
					((Statement) st).close();
				else if(st instanceof PreparedStatement) 
					((PreparedStatement) st).close();
				st = null;
			}
			if(conn!=null){
				if(!conn.isClosed()){
					conn.close();
					conn = null;
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
}
